const imageUploadModule = document.getElementById('image-upload-module');
const videoUploadModule = document.getElementById('video-upload-module');
const configUploadModule = document.getElementById('config-upload-module');
// 文件选择器,已经声明过得注释掉
const imageUpload = document.getElementById('image-upload');
const videoUpload = document.getElementById('video-upload');
const configUpload = document.getElementById('config-upload');
// 监听input的change事件
// 独立的文件选择处理函数
function handleFileSelection(e,module_element,defaultContext) {
    const file = e.target.files[0];
    const label = module_element.querySelector('p');
    console.log(`I get the label ${label}`);
    if (file) {
        // 显示选中的文件名
        label.textContent = file.name;
    } else {
    // 恢复默认状态
    label.textContent = defaultContext;
    label.classList.remove('text-red-500');
    }
}
imageUpload.addEventListener('change',(e)=>handleFileSelection(e,imageUploadModule,"点击上传图片"));
videoUpload.addEventListener('change',(e)=>handleFileSelection(e,videoUploadModule,"点击上传视频"));
configUpload.addEventListener('change',(e)=>handleFileSelection(e,configUploadModule,"点击上传配置"));
//console.log("添加注册");